// Class to create workers when parsing text
import { NodeProp } from './enums';

export interface IPlan {
  id: string;
  name: string;
  content: IPlanContent;
  query: string;
  createdOn: Date;
  formattedQuery?: string;
  ctes: Node[];
}

export interface IPlanContent {
  Plan: Node;
}

// Class to create nodes when parsing text
export class Node {
  nodeId!: number;
  size!: [number, number];
  [NodeProp.INDEX_NAME]?: string;
  [NodeProp.NODE_TYPE]?: string;
  [NodeProp.PARALLEL_AWARE]?: boolean;
  [NodeProp.PLANS]?: Node[];
  [NodeProp.PLAN_ROWS]?: number;
  [NodeProp.SUBPLAN_NAME]?: string;
  [NodeProp.TOTAL_COST]?: number;

  [k: string]:
    | Node[]
    | Worker[]
    | boolean
    | number
    | string
    | string[]
    | undefined
    | [number, number];
}
